function deep(objA, objB) {

    if (objA === objB) {
        return true;
    }

    if (typeof objA === 'object' && typeof objB === 'object') {
        if (Object.keys(objA).length !== Object.keys(objB).length) {
            return false;
        }
    }

    for (let key in objA) {

        if (!objB.hasOwnProperty(key)) {
            return false;
        }

        const value = objA[key];
        const valueB = objB[key];
        if (typeof value === 'object' && typeof valueB === 'object') {
            const currResult = deep(value, valueB);
            if (!currResult) {
                return false;
            }
        }
        if (typeof value === typeof valueB) {
            if (value !== valueB) {
                return false;
            }
        } else {
            return false;
        }

    }
    return true;
}

const a = {
    name: 'nihao',
    value: {
        high: 3
    }
}

const b = {
    name: 'nihao',
    value: {
        high: 3
    }
}

const c = {
    name: 'nihao',
    value: {
        high: 2
    }
}

console.log('a c', deep(a,c))
console.log('a b', deep(a,b))
console.log('b c', deep(b,c))
